package com.zhang;

import java.util.concurrent.CountDownLatch;

public class CountDownLatch2 {
    public static void main(String[] args) {
        CountDownLatch countDownLatch = new CountDownLatch(6);
        for (int i = 1; i <= 6 ; i++) {
            new Thread(()->{
                System.out.println(Thread.currentThread().getName()+"国，被灭！");
                countDownLatch.countDown();
            },CountryEnum.getCountry(i).getRetMessage()).start();
        }
        try {
            countDownLatch.await();
            System.out.println("秦国，一统天下！");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
